from django.db import models


# Create your models here.


class DataUpload(models.Model):
    data_type = models.IntegerField(default=0)
    data_group = models.IntegerField(default=0)
    data_content = models.TextField()
    data_upload_time = models.DateTimeField(auto_now_add=True)
    publisher_id = models.CharField(max_length=50, default='0')
    class Meta:
        db_table = 'DataUpload'


class Task(models.Model):
    task_name = models.CharField(max_length=50, default=0)
    task_status = models.IntegerField(default=0)
    task_publish_id = models.CharField(max_length=50, default='0')  # 发布者id
    task_type = models.CharField(max_length=50, default=0)
    task_publish_time = models.DateTimeField(auto_now_add=True)
    task_deadline_time = models.DateTimeField()
    task_salary = models.FloatField(default=0)
    task_description = models.CharField(max_length=200, default=0)
    task_rank = models.CharField(max_length=200, default='一级')
    task_settings = models.CharField(max_length=200, default=0)  # 项目设置
    class Meta:
        db_table = 'Task'


class Taskdata(models.Model):
    taskdata_id = models.CharField(max_length=50, default='0') # 和DataUpLoad自动生成id对应
    taskdata_task_id = models.CharField(max_length=50, default='0')  # 所属任务id
    taskdata_assign = models.CharField(max_length=50, default=0)  # 标注员id
    taskdata_result = models.CharField(max_length=2000)  # 标注结果
    taskdata_content = models.TextField()
    taskdata_status = models.CharField(max_length=10,default='0')
    class Meta:
        db_table = 'Taskdata'


class TaskApplication(models.Model):
    # TaskApplication_id = models.AutoField(primary_key=True)
    Task_id = models.CharField(max_length=100)
    Task_applier_id = models.CharField(max_length=100)
    Apply_volumn = models.BigIntegerField(null=True)
    Apply_result = models.BooleanField(default=False)
    finished_result = models.BooleanField(default=False)
    Apply_time = models.DateTimeField(null=True)
    class Meta:
        db_table = 'TaskApplication'



class Check_result(models.Model):
    Taskdata_id = models.CharField(max_length=100)
    Check_score = models.IntegerField()
    class Meta:
        db_table = 'Check_result'
